//
//  UserInfoViewController.m
//  WangLottery
//
//  Created by 黄修勇 on 12-5-20.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "UserInfoViewController.h"
#import "ChangePswViewController.h"

@interface UserInfoViewController ()

@end

@implementation UserInfoViewController

@synthesize userTableView=_userTableView;

-(void)dealloc{

    [_userTableView release];
    [super dealloc];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.title=@"个人资料";
    
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark- UITableViewDataSource

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 2;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *cellString=@"user ";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellString];
    if (!cell) {
        cell=[[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellString] autorelease];
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.backgroundColor=[UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:0.4];
    }
    
    if (indexPath.row==0) {
        cell.textLabel.text=@"手机号码";
        cell.detailTextLabel.text=@"13808695862";
        cell.accessoryType=UITableViewCellAccessoryNone;
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }else if (indexPath.row==1) {
        cell.textLabel.text=@"密码";
        cell.detailTextLabel.text=@"修改";
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.selectionStyle=UITableViewCellSelectionStyleBlue;
    }
    
    cell.textLabel.backgroundColor=[UIColor clearColor];
    cell.detailTextLabel.backgroundColor=[UIColor clearColor];
    return cell;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.row==1) {
        ChangePswViewController *change=[[ChangePswViewController alloc]initWithNibName:@"ChangePswViewController" bundle:nil];
        [self.navigationController pushViewController:change animated:YES];
        [change release];
    }
}
@end
